<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2014 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Tuolaji <479923197@qq.com>
// +----------------------------------------------------------------------
namespace Api\Controller;

use Common\Controller\AppframeController;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;

header('Content-Type: text/plain; charset=utf-8');
class PlanController extends AppframeController
{

	/*
    *  计划任务  把accunit  表里的refresh_times    refresh_num  变为0
    * */
	      function refresh(){
			     $time = strtotime(date('Y-m-d',time())." " ."00:00:01");
			     if(time()>=$time){
					 $dat['refresh_times'] = 0;
					 $dat['refresh_num'] = 0;
				 }
			  $kk =  M("tonggao")->where(" 1 ")->save($dat);
			  if($kk){
				  exit(json_encode(array("status"=>"200","data"=>"归零成功")));
			  }else{
				  exit(json_encode(array("status"=>"201","data"=>"归零失败")));
			  }

		  }
	       function is_huiyuan_guiling(){          //会员时间到了 把is_member 等信息 改了   半个小时执行一次 crontab -e
			   $time = time();
               $where = " 1 ";
			   $where .= " and etime < {$time} ";
			   $dat['is_member'] = 0;
			   $dat['stime'] = 0;
			   $dat['etime'] = 0;
			   $dat['is_zhifu'] = 0;
			   $dat['zhifu_time'] = 0;
			   M("account")->where($where)->save($dat);
			   exit(json_encode(array("status"=>"200","data"=>"归零成功")));
		   }


	        //清空测试聊天记录
	         function qingkong(){
				 include "./rongyun/master/API/rongcloud.php";
				 $appKey = 'kj7swf8okivm2';
				 $appSecret = 'TAEhDLABQsMjf';
				 $RongCloud = new \RongCloud($appKey,$appSecret);

				  $RongCloud->message()->deleteMessage('2018020124');
				 exit(json_encode(array('status'=>'200','data'=>"清空成功")));
			 }










}